package com.talent.service.iot.mqtt.model.response;

import com.talent.service.iot.mqtt.model.fix.TlMqttFixedHead;
import com.talent.service.iot.mqtt.model.variable.TlMqttUnSubAckVariableHead;
import io.netty.handler.codec.mqtt.MqttMessageType;

/**
 * @ClassName：TlMqttConnackRes
 * @Author: hszhou
 * @Date: 2024/11/25 11:12
 * @Description: 订阅响应
 */
public class TlMqttUnSubAck  {

    private TlMqttFixedHead fixedHead;

    private TlMqttUnSubAckVariableHead variableHead;

    public TlMqttFixedHead getFixedHead() {
        return fixedHead;
    }

    public void setFixedHead(TlMqttFixedHead fixedHead) {
        this.fixedHead = fixedHead;
    }

    public TlMqttUnSubAckVariableHead getVariableHead() {
        return variableHead;
    }

    public void setVariableHead(TlMqttUnSubAckVariableHead variableHead) {
        this.variableHead = variableHead;
    }

    public TlMqttUnSubAck(TlMqttFixedHead fixedHead, TlMqttUnSubAckVariableHead variableHead) {
        this.fixedHead = fixedHead;
        this.variableHead = variableHead;
    }

    public static TlMqttUnSubAck of(int messageId) {
        TlMqttFixedHead fixedHead = TlMqttFixedHead.of(MqttMessageType.UNSUBACK);
        TlMqttUnSubAckVariableHead variableHead = TlMqttUnSubAckVariableHead.of(messageId);
        return new TlMqttUnSubAck(fixedHead,variableHead);
    }

}
